package com.wzq.mapper;

import com.wzq.dao.dto.ProjectDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wzq.dao.pojo.Project;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author yzc
 * @since 2022-08-31
 */
@Mapper
public interface Projectmapper extends BaseMapper<Project> {

    @Select("SELECT * from t_project where type=#{type}")
    List<Project> getByType(String type);

    @Update("update t_project set lovenum=lovenum+#{a} where id=#{id}")
    int updateLove(@Param("a") int a,@Param("id") int id);


    List<Project> SelectResources();

    List<Project> SelectActivity();

    List<Project> SelectActivityLike(String title);

    List<Project> getVidById(int id);

    List<ProjectDto> getResourcesBySpaceNameAndUserId(@Param("space_name") String space_name, @Param("w_id") Integer w_id);

    List<Project> getResourcesByTitle(String title);

    //搜索功能：猜你需要（随机查三条资源[设备]）
    List<Project> getResourcesRan();

    //搜索功能：按名字条件查询所有活动
    List<Project> getActivityByTitle(String title);

    //搜索功能：猜你需要随机查三条活动
    List<Project> getActivityRan();

    //按类型ID查询该类型下的所有项目
    List<Project> GetProjectByType(Integer id);

    List<Project> getResourcesRanFive();
}
